package com.scuec.tourismwebsite.controller;

import com.scuec.tourismwebsite.entity.City;
import com.scuec.tourismwebsite.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/tour/v1")
public class CityController {

    @Autowired
    private CityService cityService;

    @GetMapping("/cities")
    public List<City> getCities() {
        return cityService.getAllCities();  // 返回所有城市
    }
}
//1